package inventory.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import inventory.entity.ManagerPermissionRecord;
import inventory.mappers.ManagerPermissionRecordMapper;
import inventory.service.ManagerPermissionRecordService;
import inventory.utils.UUIDUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author sxt
 * @since 2019-12-08
 */
@Service
public class ManagerPermissionRecordServiceImpl extends ServiceImpl<ManagerPermissionRecordMapper, ManagerPermissionRecord> implements ManagerPermissionRecordService {

    @Autowired
    ManagerPermissionRecordMapper managerPermissionRecordMapper;

    @Override
    public void addManagerPermissionRecord(String managerId, List<Integer> permissionListIdList) {
        for (Integer item : permissionListIdList) {
            ManagerPermissionRecord managerPermissionRecord = new ManagerPermissionRecord();
            managerPermissionRecord.setManagerId(managerId);
            managerPermissionRecord.setManagerPermRecId(UUIDUtils.getId());
            managerPermissionRecord.setPermissionListId(item);

            managerPermissionRecordMapper.insert(managerPermissionRecord);
        }
    }
}
